// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import api from './api/index'
import { CONFIG } from './config/index.js'
import { Toast,GoodsActionMiniBtn,GoodsActionBigBtn,GoodsAction,SwipeItem,Swipe,SubmitBar,Checkbox,CheckboxGroup,Stepper,Dialog,Popup,Area,Row,Col,Tab,Tabs,Picker,Switch,List,RadioGroup,Radio } from 'vant'
Vue.use(Toast)
Vue.use(GoodsActionMiniBtn)
Vue.use(GoodsActionBigBtn)
Vue.use(GoodsAction)
Vue.use(SwipeItem)
Vue.use(Swipe)
Vue.use(SubmitBar)
Vue.use(Checkbox)
Vue.use(CheckboxGroup)
Vue.use(Stepper)
Vue.use(Dialog)
Vue.use(Popup)
Vue.use(Area)
Vue.use(Row)
Vue.use(Col)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(Picker)
Vue.use(Switch)
Vue.use(List)
Vue.use(RadioGroup)
Vue.use(Radio)


Vue.use(CONFIG)
Vue.config.productionTip = false
Vue.prototype.$api = api


// 路由守卫
router.beforeEach((to,from,next)=>{
  if(to.query.patientsTitle){
    document.title = to.query.patientsTitle
  }else if(to.query.healthTitle == 'follow'){
    document.title = '随访记录'
  }else if(to.query.codeTitle == 'dealers'){
    document.title = '邀请营养师二维码'
  }else{
    if(to.meta.title){
      document.title = to.meta.title
    }
  }
  next()
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
